import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
  Search = '/risk/search',
  HistoryPage = '/risk/scan/record',
  DownloadData = '/risk/scan/download-result',
  reSearch = '/risk/scan/redo',
  SubmitData = '/risk/scan/submit',
  GetResult = '/risk/scan/result',
  getCompanyList = '/risk/legalPersonCompanys',
}

// 风险查询
export function getSearch(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.get(
    { url: Api.Search, params },
    {
      errorMessageMode: mode,
    },
  );
}

// 查询风险扫描记录列表（分页）
export function getHistoryPage(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.get(
    { url: Api.HistoryPage, params },
    {
      errorMessageMode: mode,
    },
  );
}

// 下载风险查询结果
export async function downloadData(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.download(
    {
      url: Api.DownloadData,
      method: 'GET',
      responseType: 'blob',
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
//重新查询
export function reSearchRecord(recordId: string, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: Api.reSearch + `?recordId=${recordId}` },
    {
      errorMessageMode: mode,
    },
  );
}
//重新查询
export function submitData(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: Api.SubmitData, params },
    {
      errorMessageMode: mode,
    },
  );
}
// 查询扫描状态
export function getResult(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.get(
    { url: Api.GetResult, params },
    {
      errorMessageMode: mode,
    },
  );
}

// 企业
export function getCompanyListOfperson(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: Api.getCompanyList, params },
    {
      errorMessageMode: mode,
    },
  );
}

//http://121.36.26.38:8081/risk/jmyq  假冒央企
//http://121.36.26.38:8081/risk/jdcgsx  军队采购
//http://121.36.26.38:8081/risk/jdztcg  军队暂停
//http://121.36.26.38:8081/risk/zyqygysblxwjl  央企不良
//http://121.36.26.38:8081/risk/zfcgwfsx  政府采购
//http://121.36.26.38:8081/risk/executedPersons 被执行人
//http://121.36.26.38:8081/risk/executions 失信被执行人
//http://121.36.26.38:8081/risk/limitHighConsumption  限制高消费
//http://121.36.26.38:8081/risk/courtAnnouncement  开庭公告
//http://121.36.26.38:8081/risk/notices   法院公告
//http://121.36.26.38:8081/risk/lawsuits   裁判文书
//http://121.36.26.38:8081/risk/abnormals   经营异常
//http://121.36.26.38:8081/risk/wfsx   严重违法失信企业名单
// 风险总数查询
export function getpenalize(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/penalize', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getjmyq(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/jmyq', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getjdcgsx(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/jdcgsx', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getjdztcg(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/jdztcg', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getzyqygysblxwjl(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/zyqygysblxwjl', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getzfcgwfsx(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/zfcgwfsx', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getexecutedPersons(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/executedPersons', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getexecutions(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/executions', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getlimitHighConsumption(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/limitHighConsumption', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getcourtAnnouncement(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/courtAnnouncement', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getnotices(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/notices', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getlawsuits(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/lawsuits', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getabnormals(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/abnormals', params },
    {
      errorMessageMode: mode,
    },
  );
}
export function getwfsx(params: any, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    { url: '/risk/wfsx', params },
    {
      errorMessageMode: mode,
    },
  );
}
